package cs5300;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class crash
 */
@WebServlet("/Crash")
public class Crash extends HttpServlet {
	private static final long serialVersionUID = 1L;

	public Crash() {
		super();
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		PrintWriter writer = new PrintWriter(response.getWriter());
		response.setContentType("text/html");
		writer.println("Server crashed. Bye<br>");
		SessionManager sManager = SessionManager.getInstance();
		sManager.rpcclient.stop();
		sManager.rpcServer.stop();
	}
}
